package com.litong.rms.dao.impl;

import java.util.List;

import com.litong.rms.bean.Auth;
import com.litong.rms.bean.RoleRelate;
import com.litong.rms.dao.RoleRelateDao;

public class RoleRelateDaoImpl extends BaseDaoImpl implements RoleRelateDao {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2653759714288820148L;

	public void addRoleRelate(RoleRelate roleRelate) {
		this.save(roleRelate);

	}

	public void deleteRoleRelate(RoleRelate roleRelate) {
		// TODO Auto-generated method stub

	}

	public void deleteRoleRelate(String tableName, int entityId) {
		StringBuffer queryString = new StringBuffer();
		queryString.append("delete from roleRelate");
		if(tableName.equals("sRoleId")){
			queryString.append(" where sRoleId = "+entityId);
			this.executeBySQL(queryString.toString());
		}
		

	}

	public Auth findRoleRelate(RoleRelate roleRelate) {
		// TODO Auto-generated method stub
		return null;
	}

	public <T> List<T> getRoleRelateList() {
		// TODO Auto-generated method stub
		return null;
	}

	@SuppressWarnings("unchecked")
	public List<RoleRelate> getRoleRelateList(int sRoleId) {
		Integer value = sRoleId;
		String queryString = "from RoleRelate where sRoleId = ?";
		List<RoleRelate> roleRelateList = this.find(queryString, value);
		return roleRelateList;
	}

	@SuppressWarnings("unchecked")
	public List<RoleRelate> getRoleRelateListByf(int fRoleId){
		Integer value = fRoleId;
		String queryString = "from RoleRelate where fRoleId = ?";
		List<RoleRelate> roleRelateList = this.find(queryString, value);
		return roleRelateList;
	}
	
	public void updateRoleRelate(RoleRelate roleRelate) {
		// TODO Auto-generated method stub

	}

}
